import Vue from "vue";
import VueRouter from "vue-router";

/* import Teacher from "@/views/Teacher";
import Student from "@/views/Student";
import Score from "@/views/score";
import Info from "@/views/info";
import Detail from "@/views/Detail"; */

const Teacher = () => import("@/views/Teacher");
const Student = () => import("@/views/Student");
const Score = () => import("@/views/score");
const Info = () => import("@/views/info");
const Detail = () => import("@/views/Detail");

Vue.use(VueRouter);

const router = new VueRouter({
    mode: "history",
    routes: [
        {
            path: "/teacher",
            component: Teacher,
        },
        {
            path: "/student",
            component: Student,
            redirect: "/student/info",
            children: [
                {
                    path: "/student/info",
                    component: Info,
                    name: "Info",
                    children: [
                        {
                            name: "Detail",
                            path: "/student/info/:id",
                            component: Detail,
                        },
                    ]

                },
                {
                    path: "/student/score",
                    component: Score,
                    name: "Score",
                    meta: {
                        name: "jack",
                        age: 10
                    },
                },
            ]
        },
        {
            path: "*",
            redirect: "/student",
        }
    ]
});

export default router;
